package com.brokendust.client.config.module.util;

import com.brokendust.client.config.module.button.ClickButtonJson;
import com.brokendust.client.manager.ClientManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.ArrayList;
import java.util.List;

public class ButtonJson {
    private String gui_id;
    private String button_id;
    private List<String> action_list;

    public ButtonJson() {
        this.gui_id = "";
        this.button_id = "";
        this.action_list = new ArrayList<String>();
    }

    public ButtonJson(ClickButtonJson clickButtonJson) {
        this.gui_id = "";
        this.button_id = "";
        this.action_list = new ArrayList<String>();
        this.gui_id = ClientManager.menu.menu_name;
        this.button_id = clickButtonJson.getObject_name();
        this.action_list = clickButtonJson.getCustom_action_list();
    }

    public ButtonJson(String button_id, List<String> action_list) {
        this.gui_id = "";
        this.button_id = "";
        this.action_list = new ArrayList<String>();
        this.button_id = button_id;
        this.action_list = action_list;
    }

    public ButtonJson(List<String> action_list) {
        this.gui_id = "";
        this.button_id = "";
        this.action_list = new ArrayList<String>();
        this.action_list = action_list;
    }

    public static ButtonJson readJSON(String string) {
        GsonBuilder builder = new GsonBuilder();
        Gson gson = builder.create();
        return gson.fromJson(string, ButtonJson.class);
    }

    public String getButton_id() {
        return this.button_id;
    }

    public void setButton_id(String button_id) {
        this.button_id = button_id;
    }

    public List<String> getAction_list() {
        return this.action_list;
    }

    public void setAction_list(List<String> action_list) {
        this.action_list = action_list;
    }

    public String getGui_id() {
        return this.gui_id;
    }

    public void setGui_id(String gui_id) {
        this.gui_id = gui_id;
    }
}
